<!DOCTYPE html>
<html>
<head lang="en">
	<meta charset="UTF-8">
<title>图片轮换</title>
	<link rel="stylesheet" href="css/scroll.css">

</head>

<body>
<div class="scroll">
	<div id="num">
		<a href="#" onclick="huan(1)">1</a>
		<a href="#" onclick="huan(2)">2</a>
		<a href="#" onclick="huan(3)">3</a>
		<a href="#" onclick="huan(4)">4</a>
		<a href="#" onclick="huan(5)">5</a>
		
	</div>
	<img src="img/jieda/1.gif" alt="图片" id="photo"/>
	<script type="text/javascript">
			function huan(count){
				var oldnode = document.getElementById("photo");
				var newnode = document.createElement("img");
				newnode.setAttribute("alt","图片");
				newnode.setAttribute("id","photo");
				if(count==1){
				newnode.setAttribute("src","img/jieda/1.gif");
				oldnode.parentNode.replaceChild(newnode,oldnode);
				}
				if(count==2){
				newnode.setAttribute("src","img/jieda/2.gif");
				oldnode.parentNode.replaceChild(newnode,oldnode);
				}
				if(count==3){
				newnode.setAttribute("src","img/jieda/3.jpg");
				oldnode.parentNode.replaceChild(newnode,oldnode);
				}
				if(count==4){
				newnode.setAttribute("src","img/jieda/4.jpg");
				oldnode.parentNode.replaceChild(newnode,oldnode);
				}
				if(count==5){
				newnode.setAttribute("src","img/jieda/5.gif");
				oldnode.parentNode.replaceChild(newnode,oldnode);
				}
			}
			
			
		</script>
</div>
</body>
</html>
